package models

import (
	"github.com/astaxie/beego/orm"
)
type Video struct {
	Id int
	VideNumber string
	Name string
	ThumbSrc string
	VideoDuration string
	LikeNumber string
	Score string
}
// 定义热门影片
type PopularWith struct {
	Video
}

// 定义最新影片
type NewVideo struct {
	Video
}

// 定义最高评分
type MaxScore struct {
	Video
}
// 获取热门影片
func GetPopularWith() ([]PopularWith,error){
	var buffer []PopularWith
	o := orm.NewOrm()
	_, err := o.Raw("select * from video limit 8").QueryRows(&buffer);
	return buffer,err
}

// 获取最新影片
func GetNewVideo() ([]NewVideo,error){
	var buffer []NewVideo
	o := orm.NewOrm()
	_, err := o.Raw("select * from video limit 6").QueryRows(&buffer);
	return buffer,err
}

// 获取最高评分影片
func GetMaxScore() ([]MaxScore,error){
	var buffer []MaxScore
	o := orm.NewOrm()
	_, err := o.Raw("select * from video limit 6").QueryRows(&buffer)
	return buffer, err
}